#include "app_buffer.h"
#include "log/log.h"

int main(int argc, char const *argv[])
{
    // 初始化
    Buffer *buffer = app_buffer_init(16);
    // 写入数据1
    app_buffer_write(buffer, "hello",5);
    // 写入数据2
    app_buffer_write(buffer, "world",5);

    // 读取数据1
    char data_buf[5];
    int data_len = app_buffer_read(buffer, data_buf, sizeof(data_buf));
    log_debug("读数据1: %.*s, data_len: %d",data_len, data_buf, data_len);
    // 读取数据2
    char data_buf2[10];
    int data_len2 = app_buffer_read(buffer, data_buf2, sizeof(data_buf2));
    log_debug("读数据2: %.*s, data_len: %d",data_len2, data_buf2, data_len2);
    // 释放
    app_buffer_free(buffer);
    return 0;
}

